/*
 * MIT License
 *
 * Copyright (C) 2023 Huawei Device Co., Ltd.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 *
 * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
 *
 * Do not edit this file as changes may cause incorrect behavior and will be lost
 * once the code is regenerated.
 *
 * @generated by codegen project: GeneratePropsH.js
 */
#pragma once

#include <jsi/jsi.h>
#include <react/renderer/components/view/ViewProps.h>
#include <react/renderer/core/PropsParserContext.h>
#include <react/renderer/core/propsConversions.h>
#include <react/renderer/graphics/Color.h>
#include <react/debug/react_native_assert.h>
namespace facebook {
namespace react {
struct FastImageViewSourceStruct {
    std::string uri;
    std::string priority = "normal";
    std::string cache = "web";
    std::string headers = "";
};
enum class ResizeMode {
    COVER,
    CONTAIN,
    STRETCH,
    CENTER
};

inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ResizeMode &result)
{
    react_native_expect(value.hasType<std::string>());
    if (!value.hasType<std::string>()) {
        LOG(ERROR) << "Unsupported ResizeMode type";
        result = ResizeMode::COVER;
        return;
    }

    auto stringValue = (std::string)value;
    if (stringValue == "cover") {
        result = ResizeMode::COVER;
    } else if (stringValue == "contain") {
        result = ResizeMode::CONTAIN;
    } else if (stringValue == "stretch") {
        result = ResizeMode::STRETCH;
    } else if (stringValue == "center") {
        result = ResizeMode::CENTER;
    } else {
        LOG(ERROR) << "Unsupported ResizeMode type" << stringValue;
        react_native_expect(false);
        result = ResizeMode::COVER;
    }
}

inline std::string toString(const ResizeMode &value)
{
    switch (value) {
        case ResizeMode::COVER: return "cover";
        case ResizeMode::CONTAIN: return "contain";
        case ResizeMode::STRETCH: return "stretch";
        case ResizeMode::CENTER: return "center";
    }
}

inline std::string toString(const FastImageViewSourceStruct &value)
{
    return "[Object FastImageViewSourceStruct]";
}

class JSI_EXPORT FastImageViewProps final : public ViewProps {
  public:
    FastImageViewProps() = default;
    FastImageViewProps(const PropsParserContext &context, const FastImageViewProps &sourceProps,
        const RawProps &rawProps);

#pragma mark - Props
    FastImageViewSourceStruct source{};
    ResizeMode resizeMode{ResizeMode::COVER};
    SharedColor tintColor{};
    FastImageViewSourceStruct defaultSource{};
};

} // namespace react
} // namespace facebook
